package com.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.model.Membership;

public class MembershipDAO extends GenericDAO<Membership> {

	private static final long serialVersionUID = 1L;

	public MembershipDAO() {
		super(Membership.class);
	}
	
	public Membership findMemberWithName (String name) {
		Map<String, Object> parameters = new HashMap<String, Object>();
		parameters.put("name", name);

		return super.findOneResult(Membership.FIND_MEMBERSHIP_BY_NAME, parameters);
	}
	
	public Membership findMemberWithId (int id) {
		Map<String, Object> parameters = new HashMap<String, Object>();
		parameters.put("id", id);

		return super.findOneResult(Membership.FIND_MEMBERSHIP_BY_ID, parameters);
	}	
	
	public List<Membership> listActive () {
		Map<String, Object> parameters = new HashMap<String, Object>();
		parameters.put("active", true);

		return super.findManyResult(Membership.FIND_MEMBERSHIP_BY_STATUS, parameters);
	}	
	
	public List<Membership> search(Map<String, Object> parameters){
		return super.findManyResult(Membership.SEARCH, parameters);
	}	

}
